﻿using DJY.Code;
using DJY.Domain.Entity.SystemManage;
using DJY.Domain.ViewModel;
using System;
using System.Collections.Generic;
using System.Data.Entity;

namespace DJY.Service.SystemManage
{
    /// <summary>
    /// 系统用户
    /// </summary>
    public interface ISysUserService : IDependency
    {
        #region 用户
        /// <summary>
        /// 用户登陆
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="pwd">登陆密码</param>
        /// <returns></returns>
        SysUserEntity CheckLogin(string userName,string pwd);

        /// <summary>
        /// 用户退出更新访问时间
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        int UserLogout(string userId);

        /// <summary>
        /// 获取用户登陆后需要展示的数据信息
        /// </summary>
        /// <returns></returns>
        UserClientData GetClientData(string userId);

        /// <summary>
        /// 用户查询
        /// </summary>
        /// <param name="queryInfo">查询信息</param>
        /// <returns></returns>
        PagedResult QueryUser(UserQueryInfo queryInfo);

        /// <summary>
        /// 筛选下拉用户信息
        /// </summary>
        /// <param name="queryInfo">查询条件</param>
        PagedResult SelectUserPageList(HtmlSelectQueryInfo queryInfo);

        /// <summary>
        /// 保存用户信息
        /// </summary>
        /// <param name="user">用户</param>
        EditItemResult SaveUser(SysUserEntity user);

        /// <summary>
        /// 禁用启用
        /// </summary>
        /// <param name="ids">键列表</param>
        /// <param name="state">状态</param>
        /// <param name="userId">操作用户ID</param>
        /// <returns>操作结果</returns>
        EditItemResult EnableUser(List<string> ids, bool state, string userId);
        #endregion

        #region 角色
        /// <summary>
        /// 获取角色授权信息
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="itemType">授权类型 1模块 2按钮 3列表</param>
        /// <returns></returns>
        List<SysRoleAuthorizeEntity> GetRoleAuth(string roleId, int itemType = 1);

        /// <summary>
        /// 获取角色授权信息
        /// </summary>
        /// <param name="db">数据库实例</param>
        /// <param name="roleId">角色ID</param>
        /// <param name="itemType">授权类型 1模块 2按钮 3列表</param>
        /// <returns></returns>
        List<SysRoleAuthorizeEntity> GetRoleAuth(DbContext db, string roleId, int itemType = 1);
        #endregion
    }

}
